package com.common.util;

import java.util.ArrayList;

public class AutoArrayList<T> extends ArrayList<T> {

	private static final long serialVersionUID = 1L;
	
	private T t;
    
    public AutoArrayList() {
    }
    
	@SuppressWarnings("unchecked")
	public T get(int index) {
        try {
            while (index >= size()) {
                T newInstance = (T) t.getClass().newInstance();
				add(newInstance);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return super.get(index);
    }
}